home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmiSoft / Dev / Lang / Nano.lha / nano / prog / benchm.n < prev    next >
Encoding:
Text File  |  2002-07-23  |  1019 b   |  79 lines

  1. //
  2. // on my A500 (68020, 33 mhz, 8 MB) I got this results:
  3. // loop  20 secs
  4. // array 241 secs
  5.  
  6.  
  7. decsub ctimer ();
  8. decsub ptimer ();
  9.  
  10. int i; int j; int x; int y;
  11. int a1[400][400]; int a2[400][400];
  12. int loop; int array;
  13. lint secs; lint tcks;
  14.  
  15. print /n;
  16.  
  17. // loop test
  18.  
  19. ton;
  20. i = 0;
  21. while i <= 399;
  22.     j = 0;
  23.     while j <= 399;
  24.         inc j;
  25.     wend;
  26.     inc i;
  27. wend;
  28. toff;
  29.  
  30. call ctimer ();
  31. printvn loop;
  32. call ptimer ();
  33.  
  34.  
  35. // array test
  36.  
  37. ton;
  38. i = 0;
  39. while i <= 399;
  40.     j = 0;
  41.     while j <= 399;
  42.         a1[i][j] = j;
  43.         a2[i][j] = j;
  44.         inc j;
  45.     wend;
  46.     inc i;
  47. wend;
  48.  
  49. i = 0;
  50. while i <= 399;
  51.     j = 0;
  52.     while j <= 399;
  53.         x = a1[i][j];
  54.         y = a2[i][j];
  55.         x = x * y;
  56.         a1[i][j] = x;
  57.         a2[i][j] = x;
  58.         inc j;
  59.     wend;
  60.     inc i;
  61. wend;
  62. toff;
  63.  
  64. call ctimer ();
  65. printvn array;
  66. call ptimer ();
  67.  
  68. exit;
  69.  
  70. sub ctimer ();
  71.     tcks = _timer;
  72.     secs = _timer / _timertck;
  73. endsub;
  74.  
  75. sub ptimer ();
  76.     print /s2; print "ticks: ", tcks, /s2;
  77.     print "secs: ", secs, /n2;
  78. endsub;
  79.